<template>
    <div>
        <el-form ref="form" :model="form" label-width="80px" style="width: 1000px" >
            <el-form-item label="工程名称">
            <el-input v-model="form.name"></el-input>

          </el-form-item>
          <el-form-item label="施工时间">
            <el-col :span="11">
              <el-date-picker type="date"  value-format="yyyy-MM-dd" placeholder="选择日期" v-model="form.date1" style="width: 100%;"></el-date-picker>
            </el-col>
            <el-col class="line" :span="2">----------------</el-col>

            <el-col :span="11">
              <el-date-picker type="date"  value-format="yyyy-MM-dd" placeholder="选择日期" v-model="form.date2" style="width: 100%;"></el-date-picker>
            </el-col>
            
            
          </el-form-item >
          
            
          


            <el-form :label-position="labelPosition" label-width="100px" :model="formLabelAlign" inline="true" >
                <el-form-item label="工程部位" style="width: 300px"  >
                    <el-input v-model="form.body"></el-input>
                </el-form-item>
                <br>
                <el-form-item label="金额" style="width: 200px">
                    <el-input v-model="form.count"></el-input>
                </el-form-item>
                <el-form-item label="数量 " style="width: 200px">
                    <el-input v-model="form.length"></el-input>
                </el-form-item>
                <el-form-item label="浇筑方量" style="width: 200px">
                    <el-input v-model="form.size"></el-input>
                </el-form-item>
                

              

        </el-form>

             <!-- <el-form-item label="活动形式">
            <el-input type="textarea" v-model="form.desc"></el-input>
            </el-form-item> -->


            <el-form-item>
            <el-button type="primary" @click="onSubmit">立即创建</el-button>
            <el-button>取消</el-button>
            </el-form-item> 


        </el-form>

    </div>
</template>




  <script>
    import gc from '@/api/gongcheng'
    import {L2Dwidget} from 'live2d-widget'
    export default {
      data() {
        return {
          form: {
            
            body:'',
            count:'',
            length:'',
            size:'',
            name: '',            
            date1: '',
            date2: '',            
          }
          
        }
      },
      created(){
        //添加萌萌哒可爱二次元女动漫玩偶人物
        setTimeout(function () {
            L2Dwidget.init({
                model: {
                    jsonPath: 'https://cdn.jsdelivr.net/gh/wangsrGit119/wangsr-image-bucket/L2Dwidget/live2d-widget-model-haruto/assets/haruto.model.json',
                }
                });
            },1000);
      },


      methods: {
        onSubmit() {
          gc.addgongcheng(this.form)
              .then(response => {//添加成功
              
          //提示信息
          this.$message({
              type: 'success',
              message: '添加成功!'
          });
          console.log(this.form.date1)
          console.log(this.form.date2)
          
          //回到列表页面 路由跳转
          // this.$router.push({path:'/teacher/table'})
            })
          }
          
        }
      }
    
  
  </script>

